/**
 * Keyboard events booleans
 */
boolean up_pressed = false;
boolean down_pressed = false;
boolean left_pressed = false;
boolean right_pressed = false;

void keyPressed() {
  if (keyCode == RIGHT)
    right_pressed = true;

  if (keyCode == LEFT)
    left_pressed = true;

  if (keyCode == DOWN)
    down_pressed = true;

  if (keyCode == UP)
    up_pressed = true;

  if (key == 'f' || key == 'F' )
    frame.setLocation(0, 0);
  
  if(key == 'r' || key == 'R' ){
    mode = 0;
    goal = false;
    experience.scenemanager().reset();
  }
}

void keyReleased() {
  if (keyCode == UP)
    up_pressed = false;

  if (keyCode == DOWN)
    down_pressed = false;

  if (keyCode == LEFT)
    left_pressed = false;

  if (keyCode == RIGHT)
    right_pressed = false;
}

/**
 * Test keypressed events to help the user if lost.
 */
void key_pressed() {
  if (up_pressed) {
    experience.scenemanager().moveUser(new PVector(0.03, 0, 0.03));
  }
  if (down_pressed) {
    experience.scenemanager().moveUser(new PVector(-0.03, 0, -0.03));
  }
  if (right_pressed) {
    experience.scenemanager().rotateUser(-radians(0.05));
  }
  if (left_pressed) {
    experience.scenemanager().rotateUser(radians(0.05));
  }
}

/**
 * Defines a goal position.
 */
void mousePressed() {
  if (goal) {
    if (mouseX > this.width/8) {
      experience.scenemanager().setCurrentGoalPosition((float)mouseX, (float)mouseY);
    }
  }
}
